<?php
/**
 * Created by PhpStorm.
 * User: CodeShuhao
 * Date: 2019/6/9
 * Time: 11:31
 */
/**
 * 基本公用方法（勿修改）
 */

/**
 * 菜单校验
 * @param $str
 * @param $action
 * @return
 */
function active($str, $action = NULL)
{
    $arr = explode(';', $str);

    if ( $action === 'action' )
    {
        $active = request()->controller() . '/' . request()->action();
    } else
    {
        $active = request()->module() . '/' . request()->controller();
    }

    foreach ( $arr as $value )
    {
        if ( $value == $active )
        {
            return 'active';
        }
    }
}